<?php

 
 Zend_Loader::loadClass("BaseDBRows");
 Zend_Loader::loadClass("ShipmentDetail");
 class ShipmentDetails extends BaseDBRows
 {
 	protected function setUp()
 	{
 		$this->_tableName = ShipmentDetail::_tablename;
 	}	
	
	public function getShipmentDetails($shipment_id) {
		Zend_Loader::loadClass("purchaseOrderDetail");
		Zend_Loader::loadClass("OrganizationOrganism");
		Zend_Loader::loadClass("Organism");
		Zend_Loader::loadClass("QueryCreator");
		Zend_Loader::loadClass("Tank");
		
		$query = new QueryCreator();
		
		$query->addSelect(" organism.name,shd.ship_quantity,shd.ship_amount,organism.scientific_name ");
		$query->addFrom( $this->_tableName . " shd " );
		$query->addJoin(" LEFT JOIN ". purchaseOrderDetail::_tablename . " podetail on podetail.po_detail_id = shd.po_line_no " );
		$query->addJoin(" LEFT JOIN ". OrganizationOrganism::_tablename . " orgorg on orgorg.org_organism_id = podetail.org_organism_id " );
		$query->addJoin(" LEFT JOIn ". Organism::_tablename . " organism on organism.organism_id = orgorg.organism_id ");
		//$query->addJoin(" LEFT JOIN ". Inventory::_tablename . " inv on inv.inventory_id = shd.source_tank_inventory_id " );
		
		$query->addWhere(" shd.shipment_id = ". $shipment_id );
		//echo $query->createSQL();
		$db = DBCon::instance();
		$result = $db->executeQuery($query->createSQL());
		
		return $result;
		
	}
	
 }
?>